package com.qt.controller;




import com.qt.pojo.dto.ToJudgeDTO;
import com.qt.result.R;
import com.qt.service.JudgeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author pgw
 * @version 1.0
 * @description
 * @date Create by 2023/9/26 20:43
 */
@RestController
@Slf4j
public class JudgeController {

    @Autowired
    private JudgeService judgeService;

    @PostMapping("/judge")
    public R submitProblemJudge(@RequestBody ToJudgeDTO toJudgeDTO){
        log.debug("DTO:{}" , toJudgeDTO);
       judgeService.compile(toJudgeDTO.getJudge());
        return R.success("success");
    }


    @PostMapping("/run")
    public  R runJudge(@RequestBody ToJudgeDTO toJudgeDTO){


        log.debug("DTO:{}" , toJudgeDTO);
        return judgeService.run(toJudgeDTO);
    }

}
